package logic

import (
	"context"
	"weekly2/rpc/proto/user"
	"weekly2/service/server"
)

type UserServer struct {
	user.UnimplementedUserServer
}

func (s UserServer) Register(ctx context.Context, in *user.RegisterReq) (*user.RegisterResp, error) {
	register, err := server.Register(in)
	if err != nil {
		return nil, err
	}
	return register, nil
}

func (s UserServer) Login(ctx context.Context, in *user.LoginReq) (*user.LoginResp, error) {
	login, err := server.Login(in)
	if err != nil {
		return nil, nil
	}
	return login, err
}

func (s UserServer) SendSms(ctx context.Context, in *user.SendSmsReq) (*user.SendSmsResp, error) {
	sms, err := server.SendSms(in)
	if err != nil {
		return nil, err
	}
	return sms, nil
}
